<template>
	<view class="detailed">
		<navL :navlist="navlist" @chooseNav="chooseNav"></navL>
		<view class="detail_list" v-if="isShow">
			<view class="list_item" v-for="(item,index) in list" :key="item.id">
				<view class="left">
					<image v-if="item.head_url == null" src="/static/img/logo.png"></image>
					<image v-else :src="item.head_url">
						<view class="infobox">
							<text class="title">{{item.username}}</text>
							<text class="time">{{item.add_time|ShortTime}}</text>
						</view>
				</view>
				<text class="num">{{item.remarks}} : {{item.num}}</text>
			</view>
		</view>
		<view class="noMore" v-if="!isShow">
			------- 没有更多了 -------
		</view>
	</view>
</template>

<script>
	import {
		TransferList
	} from "@/api/user.js"
	import navL from "@/components/nav/nav.vue"
	export default {
		components: {
			navL
		},
		data() {
			return {
				isShow: true,
				navlist: ['余额划转', 'YSB划转'],
				type: 1,
				list: []
			}
		},
		onLoad(e) {
			uni.setNavigationBarTitle({
				title: e.title
			})
			this.TransferList()
		},
		methods: {
			chooseNav(e) {
				if (e == 0) {
					this.type = 1
				} else if (e == 1) {
					this.type = 3
				}
				this.TransferList()
			},
			TransferList() {
				TransferList({
					type: this.type
				}).then(res => {
					this.list = res.data
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #F3F3F3;
	}

	.navList {
		display: flex;
		background-color: #fff;

		.navitem {
			width: 50%;
			text-align: center;
			padding: 10px;
			box-sizing: border-box;
		}

		.active {
			color: #FF5555;
			border-bottom: 2px solid #FF5555;
		}
	}

	.noMore {
		padding-top: 15px;
		text-align: center;
		color: #999;
	}

	.list_item {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 10px;
		background-color: #fff;
		margin-top: 10px;

		.left {
			display: flex;
			font-size: 14px;
			align-items: center;

			image {
				width: 40px;
				height: 40px;
				border-radius: 50%;
			}

			.infobox {
				margin-left: 8px;
				display: flex;
				flex-direction: column;
			}

			.title {
				font-weight: bold;

			}

			.time {

				font-size: 12px;
				margin-top: 8px;
				color: #777;
			}
		}

		.num {
			font-size: 13px;
		}
	}
</style>
